﻿@section header
{
    <script type="text/javascript" src="~/Utility/swipe-1.0.js"></script>
}
@model RiderShop.Mobile.Modle.Home.IndexViewModel
<!-- BeginSlide -->
<div class="mt5" style="-webkit-transform:translate3d(0,0,0);">
    <div style="visibility: visible;" id="banner_box" class="box_swipe">
        <ul style="list-style: none outside none; width: 1280px; transition-duration: 500ms; transform: translate3d(0px, 0px, 0px);">
            @foreach(var item in Model.Banner.TopImages)
            {
                <li style="display: table-cell; vertical-align: top;">
                    <a  href="@item.NavigateUrl">
                        <img src="@item.ActualImageUrl" alt="22" style="width:100%;">
                    </a>
                </li>
            }
        </ul>
        
        <ol>
            <li class="on"></li>
            @if (Model.Banner.TopImages.Count > 0)
            {
                for (int i = 1; i < Model.Banner.TopImages.Count; i++)
                {
                            <li ></li>
                }
            }
           
        </ol>
    </div>
</div>
<script type="text/javascript">
	$(function(){
		new Swipe(document.getElementById('banner_box'), {
			speed:500,
			auto:3000,
			callback: function(){
				var lis = $(this.element).next("ol").children();
				lis.removeClass("on").eq(this.index).addClass("on");
			}
		});
	});
</script>
<!-- End Slide -->

<!-- Begin List -->
<section>
    <div class="clear"></div>
    <ul class="v12_ul">
        <li class="card_lol">
           <div class="index-titbg" >
                <a href="@Model.Banner.TitileImage1.NavigateUrl">
                    <img src="@Model.Banner.TitileImage1.ActualImageUrl"/>
                </a>   
            </div>
        </li>

        @foreach (var group in Model.Banner.Group2Images)
        {
              <li class="card_lol">
                <a href="@group.NavigateUrl" class="tbox">
                    <img src="@group.ActualImageUrl"/>
                </a>
            </li>
        }

        <li class="card_lol">
            <div class="index-titbg" >
                <a href="@Model.Banner.TitileImage2.NavigateUrl">
                    <img src="@Model.Banner.TitileImage2.ActualImageUrl"/>
                </a>   
            </div>
        </li>
        @foreach (var group in Model.Banner.Group3Images)
        {
                <li class="card_lol">
                <a href="@group.NavigateUrl" class="tbox">
                    <img src="@group.ActualImageUrl"/>
                </a>
            </li>
        }
        
       <li class="card_lol">
            <div class="index-titbg" >
                <a href="@Model.Banner.TitileImage3.NavigateUrl">
                    <img src="@Model.Banner.TitileImage3.ActualImageUrl"/>
                </a>   
            </div>
        </li>
        @foreach (var group in Model.Banner.Group4Images)
        {
                <li class="card_lol">
                <a href="@group.NavigateUrl" class="tbox">
                    <img src="@group.ActualImageUrl"/>
                </a>
            </li>
        }
    </ul>
</section> 
<!-- End List -->
<script language="javascript" type="text/javascript">
// 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
    WeixinJSBridge.call('hideToolbar');
    // 发送给好友
    WeixinJSBridge.on('menu:share:appmessage', function (argv) {
        if (typeof (share_img) == "undefined") {
            win_open('alert', '此页面不允许转发');
        }
        else {
            shareFriend();
        }
    });
    // 分享到朋友圈
    WeixinJSBridge.on('menu:share:timeline', function (argv) {
        if (typeof (share_img) == "undefined") {
            win_open('alert', '此页面不允许转发');
        }
        else {
            shareTimeline();
        }
    });
}, false);
var appid = 'wxd6ba880532a24a07';
var share_img = "http://www.3tcare.com/Themes/Default/img/logo.png";
function shareTimeline() {
    var desc = $("#txtSitedesc").text();
    var title = $("title").html();
    WeixinJSBridge.invoke(
	'shareTimeline',
	{
	    "appid": appid,
	    "img_url": share_img,
	    "img_width": "128",
	    "img_height": "128",
	    "link": window.location.href,
	    "desc": desc,
	    "title":desc
	},
	function (res) {
	    //alert(res);
	    /*intergral("timeline");*/
	    //_report('timeline', res.err_msg);
	});
}

function shareFriend() {
    WeixinJSBridge.invoke(
        'sendAppMessage',
        {
            "appid": appid,
            "img_url": share_img,
            "img_width": "128",
            "img_height": "128",
            "link": window.location.href,
			"desc": $("#txtSitedesc").html(),
            "title": $("title").html()
        },
        function(res) {
            if (res.err_msg == "send_app_msg:confirm") {
                intergral("friend");
            }

        });
}
</script>

